
package services;

import dao.RunJpaController;
import entities.Run;
import entities.TestCase;
import entities.Submission;

public class RunService {
   private static RunJpaController rc;
   private static TestCaseService ts;
   private static SubmissionService ss;

   private RunJpaController getJPAController()
   {
       if(rc == null)
           rc = new RunJpaController();
       return rc;
   }

   private TestCaseService getTestCaseService()
   {
       if(ts == null)
           ts = new TestCaseService();
       return ts;
   }

   private SubmissionService getSubmissionService()
   {
       if(ss == null)
           ss = new SubmissionService();
       return ss;
   }

   public boolean saveRun(Run r)
   {
       rc = getJPAController();
       r.setIdRun(0);
       try
       {
           rc.create(r);
       }
       catch (Exception e)
       {
           return false;
       }
       return true;
   }


}